<script>
export default {
  name: "Chenggong",
  data() {
    return {
      countdown:5,
      timer:null,
    };
  },

  created() {

    this.startCountdown();

  },

  beforeDestroy() {

    if (this.timer) {

      clearInterval(this.timer);

    }

  },

  methods: {

    startCountdown() {

      this.timer = setInterval(() => {

        if (this.countdown > 0) {

          this.countdown--;

        } else {

          clearInterval(this.timer);

          // 修改为跳转到登录页面

          this.$router.replace('/workorderbj');
        }
      }, 1000);
    }
  }
}
</script>

<template>

  <div>
    <div>支付成功即将跳转页面{{countdown}}s</div>
  </div>

</template>

<style scoped>

</style>